<!DOCTYPE html>
<html>
    <head>
        <title>Title</title>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
        <script src="js/code.js"></script>
        <script src="js/vecmath.js"></script>
        <script src="js/three.js"></script>
        <script src="js/bullet.js"></script>
        <script src="js/scenejs.js"></script>
        <link rel="stylesheet" type="text/css" href="css/main.css">
    </head>
    <body onload="">
        <table>
            <tr>
                <td>
                    <div id="box" class="box">
                        <script>
                            var camera, scene, renderer, geometry, material, mesh;
                            init();
                            animate();
                            function init() {
                                var bbb = document.getElementById("box");
                                scene = new THREE.Scene();

                                camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 10000);
                                //camera = new THREE.PerspectiveCamera(75, box.innerWidth / box.innerHeight, 1, 10000);
                                camera.position.z = 1500;
                                //camera.position.z = 10000;

                                geometry = new THREE.CubeGeometry(200, 200, 200);
                                //geometry = new THREE.CubeGeometry(1000, 1000, 1000);
                                material = new THREE.MeshBasicMaterial({color: 0xff0000, wireframe: true});

                                mesh = new THREE.Mesh(geometry, material);
                                scene.add(mesh);

                                renderer = new THREE.CanvasRenderer();
                                //renderer.setSize(window.innerWidth, window.innerHeight);
                                renderer.setSize(box.clientWidth, box.clientHeight);

                                //document.body.appendChild(renderer.domElement);
                                bbb.appendChild(renderer.domElement);
                            }

                            function animate() {
                                // note: three.js includes requestAnimationFrame shim
                                requestAnimationFrame(animate);
                                render();
                            }

                            function render() {
                                mesh.rotation.x += 0.01;
                                mesh.rotation.y += 0.02;

                                renderer.render(scene, camera);
                            }
                        </script>
                    </div>
                </td>
            </tr>
        </table>
    </body>
</html>
